//index.js
//获取应用实例
const app = getApp()

Page({

  /**
   * 页面的初始数据
   */
  data: {
    arrange: [],
    imgurl: app.urlimg,
  },
  handles: function (e) {
    var refunds_id = e.currentTarget.dataset.refunds_id;
    wx.navigateTo({
      url: '../detail/detail?refunds_id=' + refunds_id,
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function (options) {
    var that = this;
    app.app_load(load_fn);

    function load_fn() {
      wx.showLoading({
        title: '加载中...',
      });
      wx.request({
        url: app.url + 'api_refunds/refund_list',
        data: {
        },
        header: {
          'content-type': 'application/json',
          'token': wx.getStorageSync('token_key')
        }, success: function (json) {
          console.log(json)
          wx.hideLoading();
          if (json.data.done) {
            var data = json.data.result
            that.setData({
              data: data,
            });
          } else {
            app.apperror(json.data.message);
          }

        }
      })
    }
  },
})